package com.ggh.jinjilive.views.live.music.utils;

import android.content.Context;

import com.ggh.jinjilive.R;
import com.ggh.jinjilive.views.live.music.mobile.ItemEntity;
import com.tencent.liteav.audio.TXAudioEffectManager;

import java.util.ArrayList;
import java.util.List;

public class ListUtils {

    private static final int AUDIO_REVERB_TYPE_0 = 0;
    private static final int AUDIO_REVERB_TYPE_1 = 1;
    private static final int AUDIO_REVERB_TYPE_2 = 2;
    private static final int AUDIO_REVERB_TYPE_3 = 3;
    private static final int AUDIO_REVERB_TYPE_4 = 4;
    private static final int AUDIO_REVERB_TYPE_5 = 5;
    private static final int AUDIO_REVERB_TYPE_6 = 6;
    private static final int AUDIO_REVERB_TYPE_7 = 7;
    private static final int AUDIO_VOICECHANGER_TYPE_0 = 0;
    private static final int AUDIO_VOICECHANGER_TYPE_1 = 1;
    private static final int AUDIO_VOICECHANGER_TYPE_2 = 2;
    private static final int AUDIO_VOICECHANGER_TYPE_3 = 3;
    private static final int AUDIO_VOICECHANGER_TYPE_4 = 4;
    private static final int AUDIO_VOICECHANGER_TYPE_5 = 5;
    private static final int AUDIO_VOICECHANGER_TYPE_6 = 6;
    private static final int AUDIO_VOICECHANGER_TYPE_7 = 7;
    private static final int AUDIO_VOICECHANGER_TYPE_8 = 8;
    private static final int AUDIO_VOICECHANGER_TYPE_9 = 9;
    private static final int AUDIO_VOICECHANGER_TYPE_10 = 10;
    private static final int AUDIO_VOICECHANGER_TYPE_11 = 11;



    /**
     * 混响效果
     * @param mContext
     * @return
     */
    public static List<ItemEntity> createReverbItems(Context mContext) {
        List<ItemEntity> list = new ArrayList<>();
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_origin), R.mipmap.audio_effect_setting_reverbtype_origin_high, AUDIO_REVERB_TYPE_0));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_ktv), R.mipmap.audio_effect_setting_reverbtype_ktv, AUDIO_REVERB_TYPE_1));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_room), R.mipmap.audio_effect_setting_reverbtype_room, AUDIO_REVERB_TYPE_2));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_meeting), R.mipmap.audio_effect_setting_reverbtype_meeting, AUDIO_REVERB_TYPE_3));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_lowdeep), R.mipmap.audio_effect_setting_reverbtype_lowdeep, AUDIO_REVERB_TYPE_4));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_hongliang), R.mipmap.audio_effect_setting_reverbtype_hongliang, AUDIO_REVERB_TYPE_5));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_heavymetal), R.mipmap.audio_effect_setting_reverbtype_heavymetal, AUDIO_REVERB_TYPE_6));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_reverbtype_cixing), R.mipmap.audio_effect_setting_reverbtype_cixing, AUDIO_REVERB_TYPE_7));
        return list;
    }


    /**
     * 变声
     * @param mContext
     * @return
     */
    public static List<ItemEntity> createAudioChangeItems(Context mContext) {
        List<ItemEntity> list = new ArrayList<>();
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_original), R.mipmap.audio_effect_setting_changetype_original_open, AUDIO_VOICECHANGER_TYPE_0));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_child), R.mipmap.audio_effect_setting_changetype_child, AUDIO_VOICECHANGER_TYPE_1));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_luoli), R.mipmap.audio_effect_setting_changetype_luoli, AUDIO_VOICECHANGER_TYPE_2));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_dashu), R.mipmap.audio_effect_setting_changetype_dashu, AUDIO_VOICECHANGER_TYPE_3));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_metal), R.mipmap.audio_effect_setting_changetype_metal, AUDIO_VOICECHANGER_TYPE_4));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_sick), R.mipmap.audio_effect_setting_changetype_sick, AUDIO_VOICECHANGER_TYPE_5));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_foreign), R.mipmap.audio_effect_setting_changetype_foreign, AUDIO_VOICECHANGER_TYPE_6));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_kunsou), R.mipmap.audio_effect_setting_changetype_kunsou, AUDIO_VOICECHANGER_TYPE_7));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_feizai), R.mipmap.audio_effect_setting_changetype_feizai, AUDIO_VOICECHANGER_TYPE_8));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_dianliu), R.mipmap.audio_effect_setting_changetype_dianliu, AUDIO_VOICECHANGER_TYPE_9));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_machine), R.mipmap.audio_effect_setting_changetype_machine, AUDIO_VOICECHANGER_TYPE_10));
        list.add(new ItemEntity(mContext.getResources().getString(R.string.audio_effect_setting_changetype_kongling), R.mipmap.audio_effect_setting_changetype_kongling, AUDIO_VOICECHANGER_TYPE_11));
        return list;
    }


    /**
     * 变声返回
     * @param type
     * @return
     */
    public static TXAudioEffectManager.TXVoiceChangerType translateChangerType(int type) {
        TXAudioEffectManager.TXVoiceChangerType changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_0;
        switch (type) {
            case AUDIO_VOICECHANGER_TYPE_0:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_0;
                break;
            case AUDIO_VOICECHANGER_TYPE_1:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_1;
                break;
            case AUDIO_VOICECHANGER_TYPE_2:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_2;
                break;
            case AUDIO_VOICECHANGER_TYPE_3:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_3;
                break;
            case AUDIO_VOICECHANGER_TYPE_4:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_4;
                break;
            case AUDIO_VOICECHANGER_TYPE_5:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_5;
                break;
            case AUDIO_VOICECHANGER_TYPE_6:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_6;
                break;
            case AUDIO_VOICECHANGER_TYPE_7:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_7;
                break;
            case AUDIO_VOICECHANGER_TYPE_8:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_8;
                break;
            case AUDIO_VOICECHANGER_TYPE_9:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_9;
                break;
            case AUDIO_VOICECHANGER_TYPE_10:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_10;
                break;
            case AUDIO_VOICECHANGER_TYPE_11:
                changerType = TXAudioEffectManager.TXVoiceChangerType.TXLiveVoiceChangerType_11;
                break;
        }
        return changerType;
    }


    /**
     * 混响效果
     * @param type
     * @return
     */
    public static TXAudioEffectManager.TXVoiceReverbType translateReverbType(int type) {
        TXAudioEffectManager.TXVoiceReverbType reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_0;
        switch (type) {
            case AUDIO_REVERB_TYPE_0:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_0;
                break;
            case AUDIO_REVERB_TYPE_1:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_1;
                break;
            case AUDIO_REVERB_TYPE_2:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_2;
                break;
            case AUDIO_REVERB_TYPE_3:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_3;
                break;
            case AUDIO_REVERB_TYPE_4:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_4;
                break;
            case AUDIO_REVERB_TYPE_5:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_5;
                break;
            case AUDIO_REVERB_TYPE_6:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_6;
                break;
            case AUDIO_REVERB_TYPE_7:
                reverbType = TXAudioEffectManager.TXVoiceReverbType.TXLiveVoiceReverbType_7;
                break;
        }
        return reverbType;
    }
}
